﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="login.aspx.cs" Inherits="login" %>

<%@ Register Src="theme.ascx" TagName="theme" TagPrefix="thm" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Inicio de sesión</title>
</head>
<body>
    <form id="form1" runat="server">
    <div class="headerbar">
        <thm:theme ID="th" runat="server" />
        <a href="default.aspx">Inicio</a>
        <hr />
    </div>
    <div id="body_div_reduced">
        <div style="width:260px; padding-left:25px;" class="b_cent">
            <span class="membrete">Perfil</span>
            <asp:RadioButtonList ID="rbl_perfil" runat="server" RepeatDirection="Horizontal">
                <asp:ListItem Selected="True" Text="Usuario"></asp:ListItem>
                <asp:ListItem Text="Empresa"></asp:ListItem>
            </asp:RadioButtonList>
            <span class="membrete" id="username">DNI</span>
            <asp:TextBox ID="txt_username" runat="server" MaxLength="20"></asp:TextBox>
            <span class="membrete">Contraseña</span>
            <asp:TextBox ID="txt_pass" runat="server" MaxLength="20" TextMode="Password"></asp:TextBox>
            <div style="margin-left: auto auto;">
                <asp:CheckBox ID="chk_keeplogued" runat="server" Text="Recordarme" CssClass="membrete" />
                <ul id="ul_errores" runat="server"></ul>
                <asp:Button ID="btn_login" runat="server" Text="Ingresar" OnClick="btn_login_Click"/>
                <a class="anchorcreate nui" id="crearcuenta" href="javascript:void(0);">
                    CREAR CUENTA</a>
            </div>
            <script type="text/javascript">
                $(document).ready(bind_rbl_length);
                aspbh_endHandler.push(bind_rbl_length);
                
                var id_rbl_perfil = "<%= rbl_perfil.ClientID %>";
                
                function bind_rbl_length(){
                    $("#" + id_rbl_perfil).click(setUserMaxLen);
                    setUserMaxLen();
                }
                
                function setUserMaxLen()
                {
                    var lbl_user = $("#username");
                    var txt_user = $("#<%= txt_username.ClientID %>");
                    var a_crearcuenta = $("#crearcuenta");
                    
                    
                    txt_user.val("");
                    
                    if('Usuario'==$(':checked','#rbl_perfil').first().val())
                    {
                        lbl_user.html("DNI");
                        txt_user.attr("MaxLength","8");
                        a_crearcuenta.attr("href","UsrRegistracion.aspx");
                    }
                    else
                    {
                        lbl_user.html("CUIL/T");
                        txt_user.attr("MaxLength","11");
                        a_crearcuenta.attr("href","EmpRegistracion.aspx");
                    }                       
                }
                
            </script>
        </div>
    </div>
    </form>
</body>
</html>
